import React from 'react';
import {Image, View} from 'react-native';
import PropTypes from 'prop-types';
import {Map} from './map';

export default class Ticon extends React.Component {
    static propTypes = {
        size: PropTypes.number,
        color: PropTypes.string,
        name: PropTypes.string,
        style: PropTypes.object
    };

    static defaultProps = {
        size: 30,
        color: '#333',
        name: 'blank',
        style: {}
    };

    render() {
        const {size, color, name} = this.props;
        return (
            <View style={{
                width: size,
                height: size,
                justifyContent: 'center',
                ...this.props.style
            }}>
                <Image style={{
                    tintColor: color,
                    width: size,
                    height: size,
                    resizeMode: 'contain'
                }} source={Map[name]}/>
            </View>
        );
    }
}
